/**
 * 创建提示窗体
 * @param width 宽度
 * @param height 高度
 * @param msghead id开头
 * @param posX 横向位置
 * @param posY 纵向位置
 * @param bordercolor 窗体标题颜色
 * @return 窗体引用
 */
function createMsgBody(width, height, msghead, posX, posY, bordercolor) {
	var msgObj = document.createElement('div');
	msgObj.setAttribute('id', msghead + 'msgDiv');
	msgObj.setAttribute('align', 'center');
	msgObj.style.background = 'white';
	msgObj.style.border = '1px solid ' + bordercolor;
	msgObj.style.position  =  'absolute';
	msgObj.style.left  =  posX;
	msgObj.style.top  =  posY;
	msgObj.style.font = '12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif';
	msgObj.style.marginLeft  =  '-225px' ;
	msgObj.style.marginTop  =  -75 + document.documentElement.scrollTop + 'px';
	msgObj.style.width  =  width + 'px';
	msgObj.style.height  = height + 'px';
	msgObj.style.textAlign  =  'center';
	msgObj.style.lineHeight  = '25px';
	msgObj.style.zIndex  =  '10001';
	return msgObj;
}

/**
 * 创建标题文字
 * @param titleMsg 文字内容
 * @param titleHead id开头
 * @param bordercolor 背景颜色
 * @return
 */
function createTitle(titleMsg, titleHead, bordercolor) {
	var title = document.createElement('h3');
	title.setAttribute('id', titleHead + 'msgTitle');
	title.setAttribute('align', 'center');
	title.style.margin = '0';
	title.style.padding = '3px';
	title.style.background = bordercolor;
	title.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(startX = 20, startY = 20, finishX = 100, finishY = 100,style = 1,opacity = 75,finishOpacity = 100);';
	title.style.opacity = '0.75';
	title.style.border = '1px solid ' + bordercolor;
	title.style.height = '18px';
	title.style.font = '14px Verdana, Geneva, Arial, Helvetica, sans-serif';
	title.style.color = 'white';
	title.style.cursor = 'normal';
	title.appendChild(document.createTextNode(titleMsg));
	return title;
}

/**
 * 显示提示信息
 * @param str 要提示的信息
 * @param titlemsg
 * @param wcolor
 * @param isreload
 */
function createAlertWindow(str, titlemsg, wcolor, isreload) {
	var msgObj = createMsgBody(400, 100, '', '50%', '50%', wcolor);
	var title = createTitle(titlemsg, '', wcolor);
	document.body.appendChild(msgObj);
	msgObj.appendChild(title);
	var txt = document.createElement('p');
	txt.style.margin = '1em 0';
	txt.setAttribute('id', 'msgTxt');
	txt.appendChild(document.createTextNode(str));
	msgObj.appendChild(txt);
	var btnDiv = document.createElement('div');
	btnDiv.setAttribute('id', 'btndiv');
	btnDiv.setAttribute('align', 'center');
	var btnOk = document.createElement('input');
	btnOk.setAttribute('id', 'btnok');
	btnOk.setAttribute('align', 'center');
	btnOk.setAttribute('type', 'button');
	btnOk.setAttribute('value', '\u786e\u5b9a');
	btnOk.style.background = '#99CCFF';
	btnOk.onclick = function() {
		msgObj.removeChild(title);
		btnDiv.removeChild(btnOk);
		msgObj.removeChild(btnDiv);
		document.body.removeChild(msgObj);
		if(isreload)
			window.location.reload();
	};
	btnDiv.appendChild(btnOk);
	msgObj.appendChild(btnDiv);
}
